package com.itheima.utils;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import com.itheima.po.Customer;
import com.itheima.po.Jxjh1;

public class Jxjh1test {
	@Test
	public void findAllUserTest() {
		// 获取SqlSession
		SqlSession sqlSession = MybatisUtils.getSession();
		// SqlSession执行映射文件中定义的SQL，并返回映射结果
		List<Jxjh1> list = sqlSession.selectList("com.itheima.mapper.Jxjh1Mapper.findAllJxjh1");
		for (Jxjh1 jxjh1 : list) {
			System.out.println(jxjh1);
		}
		// 关闭SqlSession
		sqlSession.close();
	}
	
	/**
	 * 2.根据用户名称来模糊查询用户信息列表
	 */
	@Test
	public void findJxjh1ByNameTest() {		
		// 获取SqlSession
		SqlSession sqlSession = MybatisUtils.getSession();
		// SqlSession执行映射文件中定义的SQL，并返回映射结果
		List<Jxjh1> jxjh1s = sqlSession.selectList("com.itheima.mapper"
				+ ".Jxjh1Mapper.findJxjh1ByName", "A");
		for (Jxjh1 jxjh1 : jxjh1s) {
			//打印输出结果集
			System.out.println(jxjh1);					
		}
		// 关闭SqlSession
		sqlSession.close();
	}
}
